package com.black.carbon.service.impl;

import com.black.carbon.entity.User;
import com.black.carbon.mapper.UserMapper;
import com.black.carbon.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
//别忘了加注解，加注解为了将类加载到ioc容器中
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;
    //这里autowired自动从ioc拿对象usermapper
    @Override
    public User findById(Integer id) {
        return userMapper.selectById(id); //这里我们直接调了basemapper里面为我们定义好的接口
    }
}
